import Vue from 'vue'
import Router from 'vue-router'

//首页
import Index from '@/pages/home/Index';

//服务模块
import Deliver_service from '@/pages/service/Deliver_service'
import Mall from '@/pages/service/Mall'
import Mission from '@/pages/service/Post_mission'
import Deliver_info from '@/pages/service/components/deliver/Deliver_info'
import Goods_details from '@/pages/service/components/mall/Goods_details'
import Purchase from '@/pages/service/components/mall/Purchase'


//个人中心
import Personal_index from '@/pages/personal_center/index/Personal_index';
import About from '@/pages/personal_center/about/About'
import Login from '@/pages/personal_center/login/Login'
import Register from '@/pages/personal_center/register/Register'
import Cart from '@/pages/personal_center/cart/Cart'
import Order from '@/pages/personal_center/order/OrderList'
import Address from '@/pages/personal_center/address/Address'
import Edit_address from '@/pages/personal_center/address/Edit_address'
import Add_address from '@/pages/personal_center/address/Add_address'
import UserInfo from '@/pages/personal_center/userInfo/UserInfo'

Vue.use(Router)

export default new Router({
  mode:'history',
  routes: [
    //把默认的路由 '/' 重定向到 '/index'上
    { path: '/', redirect: '/index'},
    //首页
    {
      path: '/index',
      name: 'Index',
      component: Index
    },
    //发布任务
    {
      path: '/post_mission',
      name: ' Post_mission',
      component:  Mission
    },
    //快递服务
    {
      path: '/deliver_service',
      name: 'Deliver_service',
      component: Deliver_service
    },
    {
      path: '/deliver_info/:id',
      name: 'Deliver_info',
      component: Deliver_info
    },
    //二手商城
    {
      path: '/mall',
      name: 'Mall',
      component: Mall
    },
    {
      path: '/goods_details/:id',
      name: 'Goods_details',
      component: Goods_details
    },
    {
      path: '/purchase',
      name: 'Purchase',
      component: Purchase
    },
    //个人中心
    {
      path: '/personal_index',
      name: 'Login',
      component: Personal_index
    },
    {
      path: '/about',
      name: 'About',
      component: About
    },
    {
      path: '/login',
      name: 'Personal_index',
      component: Login
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    },
    {
      path: '/cart',
      name: 'Cart',
      component: Cart
    },
    {
      path: '/order',
      name: 'Order',
      component: Order
    },
    {
      path: '/address',
      name: 'Address',
      component: Address
    },
    {
      path: '/edit_address/:id',
      name: 'Edit_address',
      component: Edit_address
    },
    {
      path: '/add_address',
      name: 'Add_address',
      component: Add_address
    },
    {
      path: '/user_info',
      name: 'UserInfo',
      component: UserInfo
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})
